######################################################
#
# link /opt/node_modules to work dir
# gitbook build src_dir dest_dir
# gitbook pdf srcdir
# 
# plantuml test command
# java -Dapple.awt.UIElement=true -jar plantuml.jar -nbthread auto -tsvg  plantuml.uml -o test.pn
# mkdir -p assets/images/uml/
# 将plantuml.jar根目录
# 
######################################################

# base image
# FROM node:11.1
FROM opensuse:tumbleweed

MAINTAINER pubyinlong@gmail.com

RUN zypper in -y glibc-locale
RUN zypper in -y nodejs npm
RUN zypper in -y tar vi
RUN zypper in -y java graphviz
RUN zypper in -y wqy*fonts
RUN useradd --no-create-home --shell /dev/null nobody

# RUN npm config set prefix /usr/local
# RUN npm config get prefix
RUN npm install -g gitbook-cli
# cache svgexport require pkg, because download very very slow
COPY phantomjs-2.1.1-linux-x86_64.tar.bz2 /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
RUN npm install -g --unsafe-perm svgexport
RUN npm install -g --unsafe-perm gitbook-plugin-plantuml
WORKDIR /opt/gitbook

# install gitbook plugins
COPY plantuml.jar /opt/gitbook
COPY plantuml.1.2018.12.jar /opt/gitbook
COPY book.json /opt/gitbook
RUN gitbook install
RUN mv /opt/gitbook/book.json /opt/gitbook/book.json-plugins

WORKDIR /root

